import Loading from './loading.vue'

Loading.install = function(Vue) {
    Vue.component(Loading.name, Loading);

    Vue.prototype.$bcLoading = function(options) {
        let Constructor = Vue.extend(Loading);
        let instance = new Constructor({
            propsData: options
        });
        instance.$mount();
        document.body.appendChild(instance.$el);
    };
    Vue.prototype.$bcLoadingClose = function() {
        document.body.childNodes.forEach(item => {
            if(item.className === 'bc-loading') {
                document.body.removeChild(item);
            }
        })
    }
}

export default Loading;